package dtmc;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class T1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i=0; i<n; i++) {
            array[i] = sc.nextInt();
        }
        int[] respectTicket = new int[n];
        Arrays.fill(respectTicket, 0);
        /*
        从后往前遍历，初始化为0，如果前面的后面崇拜的全部选票
            5
            0 1 2 0 3
            0 0 0 0 0
            0 0 1 0 0
            0 0 1 0 0
            0 2 0 0 0
            3 2 1 0 0
         */
        for (int i=respectTicket.length-1; i>=0; i--) {
            if (array[i] == 0)  continue;
            respectTicket[array[i]-1] = 1 + respectTicket[i];
        }

        // 如果2崇拜1，3崇拜2， 那么应该全部投给1
        for (int i=0; i<n; i++) {
            System.out.println(1 + respectTicket[i]);
        }
    }
}
